<template>
  <div>
    <div class="timeline-container">
      <div class="title">博客时间轴</div>
      <div class="timeline">
        <a-timeline>
          <a-timeline-item v-for="item in blogList" :key="item.blogId">
            <div class="timeline-item">
              <span class="create-time" v-text="item.createdTime" />
              <span class="blog-title" v-text="item.blogTitle" />
            </div>
          </a-timeline-item>
        </a-timeline>
      </div>
    </div>
  </div>
</template>
<script>
import blogApi from '@/api/blog'
export default {
  data() {
    return {
      blogList: []
    }
  },
  created() {
    this.getTimeline()
  },
  methods: {
    getTimeline() {
      blogApi.getTimeline().then(resp => {
        this.blogList = resp.data
      })
    }
  }
}
</script>
<style scoped>
.title {
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 45px;
}
.timeline-container {
  background-color: #fff;
  padding: 25px 20px;
}
.timeline {
  margin-left: 30px;
}
.timeline-item {
  display: flex;
  flex-direction: row;
  align-items: center;
}
.blog-title {
  display: inline-block !important;
  max-width: 550px !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: 20px;
}
.create-time {
  color: #999999;
}
</style>
